 <%@ taglib prefix="fn2" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="css/style.css" rel="stylesheet"
	type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>资金结算报表</title>
<style>
.title {
	display: block;
	background: #5a98de;
	line-height: 31px;
	float: left;
	color: white;
	width: 95px;
	text-align: center;
}

.title:hover {
	text-decoration: none;
	color: white;
}
</style>
</head>

<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页
		 <span class="c-gray en">&gt;</span>配送员结算列表
	
		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px" onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>
	</nav>
	
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray">
			<a id="one" name="-1" class="title rleft def">全部</a>
			<a id="two" name="1" class="title def">待处理</a>
			<a id="three" name="2" class="title rright def">已处理</a>
		</div>		
		<div class="mt-20"></div>
	
		<div class="cl pd-5 bg-1 bk-gray"> 
		<form action="<%=path%>/backstage/shipper_statistic_list" method="get" class="form form-horizontal" id="search-form" >
			<input type="hidden" id="status" name="status" value="${conditions.status}">
			<div class="text-c"> 
				<div class="row cl">
					<label class="form-label col-1">配送员账号：</label>
					<div class="formControls col-2">
					<input type="text" name="c_mob" value="${conditions.c_mob}"  id="c_mob" placeholder="配送员账号" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">配送员姓名：</label>
					<div class="formControls col-2">
					<input type="text" name="c_tname" value="${conditions.c_tname}"  id="c_mob" placeholder="配送员账号" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">订单数：</label>
					<div class="formControls col-2">
					<input type="text" name="order_count" value="${conditions.order_count}"  id="c_mob" placeholder="订单数" class="input-text col-2">
					</div>
				</div>
				
				<div class="row cl">
				<label class="form-label col-1">分站名称：</label>
					<div class="formControls col-2">
					<input type="text" name="cityName" value="${conditions.cityName}"  id="c_mob" placeholder="分站名称" class="input-text col-2">
					</div>
				<label class="form-label col-1">结算日期：</label>
					<div class="formControls col-2">
						<input type="text"  name="stime" readonly="readonly"  onfocus="WdatePicker({maxDate:'%y-%M-{%d-1}'})"  value="${conditions.stime}"  id="datemin" class="input-text Wdate" >
					</div>
				</div>
				<div class="mt-10"></div>
				
				
				
				<div class="row cl">
					<button name="" id="" class="btn btn-success" style="border-radius:5px;float:right;" type="submit">
						 查询
					</button>
					<div style="width:10px;height:5px;float:right;"></div>
					<button name="" onclick="theReset();" id="" class="btn btn-success" style="border-radius:5px;float:right;" >
						 重置
					</button>
				</div>
				
			</div>
		</form>
		</div>

		<div class="mt-20">
		 <c:if test="${!empty stats}">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						
                       <!--  <th width="100">ID</th> -->
                        <th width="100">结算日期</th>
                        <th width="100">配送员账号</th>
                        <th width="100">配送员名字</th>
                        <th width="100">所属分站</th>
                        <th width="100">订单数</th>
						<th width="100">货到付款金额</th>
						<th width="100">商户现结金额</th>
						<!-- <th width="100">结算差异</th>
						<th width="100">结算</th> -->
						<th width="100">当时备用金额度</th>
						<!-- <th width="100">当时余额</th> -->
						<th width="100">合计总额(负数代表充值,正数代表上交)</th>
                        <th width="100">备注</th>
						<th width="200">操作</th>
					</tr>
				</thead>
				<tbody>
						<c:forEach items="${stats}" var="stat">
						
						<tr class="text-c" id="${stat.stats_id}">
                            <%-- <td>${stat.stats_id}</td> --%>
                            <td>${stat.year}-${stat.month}-${stat.day}</td>
                            <td data-name='c_mob'>${stat.c_mob}</td>
                            <td data-name='c_tname'>${stat.c_tname}</td>
                            <td data-name='cityName'>${stat.cityName}</td>
                            <td>${stat.order_count}</td>
                            <td>
                            	<c:if test="${stat.on_delivery_money >0}">+</c:if>${stat.on_delivery_money}
                            </td>
                            <td><c:if test="${stat.cash_term_money >0}">-</c:if>${stat.cash_term_money}</td>
                            <td>${stat.reserve_money}</td>
                            <%-- <td>${stat.money}</td> --%>
                            <td data-name='should-money'>${fn2:split(stat.on_delivery_money - stat.cash_term_money,'.')[0]}.${fn2:substring(fn2:split(stat.on_delivery_money - stat.cash_term_money ,'.')[1],0,2)}</td>
                           	<td>   
                           		<c:if test="${stat.on_delivery_money - stat.cash_term_money >= 0 }">
                           			上交站长
                           		</c:if>
                           		<c:if test="${stat.on_delivery_money - stat.cash_term_money < 0 }">
                           			备用金充值
                           		</c:if>
                           	</td>
                            
							<td class="td-manage">
								<a  class="label label-primary radius"
								onClick="t_shipping_edit(this,'${stat.shipper_id}','${stat.year}','${stat.month}','${stat.day}','${stat.stats_id}')" href="javascript:void(0);"
								title="详情">详情</a>
								<c:if test="${(stat.on_delivery_money - stat.cash_term_money < 0) && stat.handle_status == 0 }">
                           			<a  class="label label-primary radius"
								     onClick="t_shipping_close('${stat.stats_id}',1)" href="javascript:void(0);"
								    title="充值">充值</a>
                           		</c:if>
								<c:if test="${(stat.on_delivery_money - stat.cash_term_money  >= 0) && stat.handle_status == 0 }">
                           			<a  class="label label-primary radius"
								     onClick="t_shipping_close('${stat.stats_id}',2)" href="javascript:void(0);"
								    title="结算">结算</a>
                           		</c:if>
                           		<c:if test="${stat.handle_status == 1}">
                           			<a  class="label label-success radius"  href="javascript:void(0);" title="">已充值</a>
                           		</c:if>
                           		<c:if test="${stat.handle_status == 2}">
                           			<a  class="label label-success radius"  href="javascript:void(0);" title="">已结算</a>
                           		</c:if>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			</c:if>
			<c:if test="${empty stats}">
				<h3>暂无数据</h3>
			</c:if>
			<div id="Pagination" class="page-con"></div>
			
			<input type="hidden" id="stats_id">
			<input type="hidden" id="type">
			<input type="hidden" id="money">
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	<script type="text/javascript">
	$(function() {
		initPager();
	});
	
	var showCount = ${pageInfo.showCount};
	var currentPage = ${pageInfo.currentPage-1};
	var totalResult = ${pageInfo.totalResult};
	function initPager(){
		$("#Pagination").pagination(totalResult, {
            callback: function(new_page_index, pagination_container){
            	var oldLocation = location.href;
            	var pa = "currentPage=" + (new_page_index+1);
        		var shoC = "showCount=" + showCount;
            	var index = oldLocation.lastIndexOf("?");
            	if (index == -1){
            		location.href = oldLocation + "?" + pa + "&" + shoC;
            	}else if (oldLocation.indexOf("currentPage") == -1){
            		location.href = oldLocation + "&" + pa;
            	}else if (oldLocation.indexOf("showCount") == -1){
            		location.href = oldLocation + "&" + shoC;
            	}else{
            		var temp = oldLocation.replace(/currentPage=\d+/, pa);
					var newLocation = temp.replace(/showCount=\d+/, shoC);
            		location.href = newLocation;
            	}
            	return false;
            },
            items_per_page:showCount, 
            load_first_page:false,
            prev_text:'上一页',
            next_text:'下一页',
            ellipse_text:'...',
            num_edge_entries:1,
            num_display_entries:5,
            current_page:currentPage,
        });
	}
		
	/*
	重置
	*/
	function theReset(){
		$("#search-form input[type='text']").val('');
		$("#search-form select").val(-1);
		$("#endType").val("-1");
	}
		
		/*详情*/
		function t_shipping_edit(obj,userId,year,month,day,stats_id){
			var edit_page = "<%=path%>/backstage/shipper_order_list?userId="+userId + "&year=" + year + "&month=" + month + "&day=" + day + "&stats_id=" + stats_id;
			layer_show("详情",edit_page);
		}
		
		/*结算或者充值 type --  1: 充值 ; 2:结算*/
		function t_shipping_close(stat_id,type){
			$("#stats_id").val(stat_id);
			$("#type").val(type);
			var hint = '';
			if (type == 1){
				hint = '充值确认';
			}
			if (type == 2){
				hint = '结算确认';
			}
			var edit_page = "<%=path%>/backstage/handle_stat.jsp";
			layer_show(hint,edit_page);
		}

		/*立即派单*/
		function t_shipping_allocate(obj,id,title,w,h){
			var edit_page = "<%=path%>/backstage/Shippers_pd?shipping_id="+id+"&titles="+title+"&thetype=1";
			layer_show("立即派单",edit_page,w,h);
		}
		
		/*更改派单*/
		function Shippers_change_pd(obj,id,title,w,h){
			var edit_page = "<%=path%>/backstage/Shippers_change_pd?shipping_id="+id+"&titles="+title+"&thetype=1";
			layer_show("更改派单",edit_page,w,h);
		}
		
		
		if($("#status").val()==-1){
			$("#one").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#two").css({"background":"white","border":"1px solid black","color":"black"});
			$("#three").css({"background":"white","border":"1px solid black","color":"black"});
		}else if($("#status").val() != '' && $("#status").val()==0){
			$("#one").css({"background":"white","border":"1px solid black","color":"black"});
			$("#two").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#three").css({"background":"white","border":"1px solid black","color":"black"});
		}else if($("#status").val()==1){
			$("#one").css({"background":"white","border":"1px solid black","color":"black"});
			$("#two").css({"background":"white","border":"1px solid black","color":"black"});
			$("#three").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}else {
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$("#one").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}
		//选择状态
		$("#one").click(function(){
			$("#status").val(-1);
			$("#search-form").submit();
			$("#one").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#two").css({"background":"white","border":"1px solid black","color":"black"});
			$("#three").css({"background":"white","border":"1px solid black","color":"black"});
		});
		//选择状态(待处理)
		$("#two").click(function(){
			$("#status").val(0);
			$("#search-form").submit();
			$("#one").css({"background":"white","border":"1px solid black","color":"black"});
			$("#two").css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#three").css({"background":"white","border":"1px solid black","color":"black"});
		});
		//选择状态(已处理)
		$("#three").click(function(){
			$("#status").val(1);
			$("#search-form").submit();
			$("#one").css({"background":"white","border":"1px solid black","color":"black"});
			$("#two").css({"background":"white","border":"1px solid black","color":"black"});
			$("#three").css({"background":"#5a98de","border":"1px solid #5a98de"});
		});
		
	</script>
</body>
</html>



